(self.webpackChunkmp_webgl = self.webpackChunkmp_webgl || []).push([
  [983],
  {
    59855: (e, t, s) => {
      "use strict";
      s.d(t, { t: () => o });
      var i = s(98828),
        r = s(81812);
      const o = {
        tileset: (0, i.h)("tileset", ""),
        hideMenu: "1" !== (0, i.h)("dmenu", "0"),
        debug: "1" === (0, i.h)("debugTiles", "0"),
        displayBoxBounds: !1,
        initialMaxDepth: 0,
        maxDepth: Number((0, i.h)("maxDepth", "6")),
        colorMode: r.c.NONE,
        loadSiblings: !0,
        displayActiveTiles: !0,
        autoDisableRendererCulling: !1,
        optimizeRaycast: !1,
        stopAtEmptyTiles: !0,
        statsTiles: !0,
        statsTextures: !1,
        statsTextureStream: !1,
        debugGeometricError: (0, i.h)("geometricError", "0.3,0.06,0.015,0.003"),
        errorTarget: Number((0, i.h)("errorTarget", 4)),
        disableTileUpdates: !1,
        useOcclusionInfo: !0,
        tileSightingTTL: 5e3,
      };
    },
    81812: (e, t, s) => {
      "use strict";
      s.d(t, { c: () => i });
      const i = {
        NONE: 0,
        SCREEN_ERROR: 1,
        GEOMETRIC_ERROR: 2,
        DISTANCE: 3,
        DEPTH: 4,
        RELATIVE_DEPTH: 5,
        IS_LEAF: 6,
        RANDOM_COLOR: 7,
        RANDOM_NODE_COLOR: 8,
      };
    },
    36429: (e, t, s) => {
      "use strict";
      s.r(t), s.d(t, { createModelMesh: () => N });
      var i = s(96909),
        r = s(59088),
        o = s(72067),
        n = s(62955),
        a = s(21922),
        d = s(40324),
        l = s(51245),
        h = s(2212),
        u = s(88512),
        c = s(25543),
        m = s(79554),
        p = s(91283),
        g = s(59855),
        T = s(44283),
        R = s(19131);
      const L = new (s(65046).I)();
      var x = s(2388),
        f = s(84561),
        v = s(96367);
      class MTTRMeshBvh {
        constructor(e) {
          (this.parser = e), (this.name = "MTTR_three_mesh_bvh");
        }
        async loadMesh(e) {
          const t = async (t, s) => {
              var i, r;
              const o = this.parser.json.meshes[e].primitives[s];
              if (
                null === (i = o.extensions) || void 0 === i
                  ? void 0
                  : i.MTTR_three_mesh_bvh
              ) {
                const e =
                    null === (r = o.extensions) || void 0 === r
                      ? void 0
                      : r.MTTR_three_mesh_bvh,
                  s = {
                    roots: (
                      await Promise.all(
                        e.roots.map((e) => this.parser.loadAccessor(e))
                      )
                    ).map((e) => e.array.buffer),
                    index: void 0,
                  };
                t.geometry.boundsTree = v.r.deserialize(s, t.geometry, {
                  setIndex: !1,
                });
              }
            },
            s = [],
            i = await this.loadMeshInternal(e);
          if (i)
            if ("Group" === i.type) {
              const e = i;
              s.push(...e.children.map((e, s) => t(e, s)));
            } else "Mesh" === i.type && s.push(t(i, 0));
          return await Promise.all(s), i;
        }
        async loadMeshInternal(e) {
          const t = this.parser,
            s = t,
            i = this.parser.json.meshes[e],
            r = i.primitives,
            o = [];
          for (let e = 0, i = r.length; e < i; e++) {
            const i =
              void 0 === r[e].material
                ? t.createDefaultMaterial(s.cache)
                : t.getDependency("material", r[e].material);
            o.push(i);
          }
          return (
            o.push(t.loadGeometries(r)),
            Promise.all(o).then(function (s) {
              const o = s.slice(0, s.length - 1),
                n = s[s.length - 1],
                d = [];
              for (let s = 0, l = n.length; s < l; s++) {
                const l = n[s],
                  h = r[s];
                let u;
                const c = o[s];
                if (h.mode !== y.TRIANGLES && void 0 !== h.mode)
                  throw new Error(
                    "THREE.GLTFLoader: Primitive mode unsupported: " + h.mode
                  );
                (u = new a.g(0, 0, f.o.DEFAULT)),
                  (u.geometry = l),
                  (u.material = c),
                  (u.name = t.createUniqueName(i.name || "mesh_" + e)),
                  E(u, i),
                  t.assignFinalMaterial(u),
                  d.push(u);
              }
              if (1 === d.length) return d[0];
              const l = new h.Group();
              for (let e = 0, t = d.length; e < t; e++) l.add(d[e]);
              return l;
            })
          );
        }
      }
      const y = {
        FLOAT: 5126,
        FLOAT_MAT3: 35675,
        FLOAT_MAT4: 35676,
        FLOAT_VEC2: 35664,
        FLOAT_VEC3: 35665,
        FLOAT_VEC4: 35666,
        LINEAR: 9729,
        REPEAT: 10497,
        SAMPLER_2D: 35678,
        POINTS: 0,
        LINES: 1,
        LINE_LOOP: 2,
        LINE_STRIP: 3,
        TRIANGLES: 4,
        TRIANGLE_STRIP: 5,
        TRIANGLE_FAN: 6,
        UNSIGNED_BYTE: 5121,
        UNSIGNED_SHORT: 5123,
      };
      function E(e, t) {
        void 0 !== t.extras &&
          "object" == typeof t.extras &&
          Object.assign(e.userData, t.extras);
      }
      var M = s(10338),
        S = s(17047);
      class CrossModelTextureCache {
        constructor(e) {
          (this.parser = e), (this.name = "CrossModelTextureCache");
        }
        static addToLoader(e) {
          e.pluginCallbacks.unshift((e) => new CrossModelTextureCache(e));
        }
        loadTexture(e) {
          var t;
          const s = this.parser,
            i = s.json,
            r = i.textures[e];
          let o = r.source;
          Object.keys(r.extensions).forEach(
            (e) => (o = o || r.extensions[e].source)
          );
          const n = null === (t = i.images[o]) || void 0 === t ? void 0 : t.uri;
          if (void 0 === n) return null;
          const a = b.get(n);
          if (a) return a;
          let d = s._invokeOne((t) =>
            t === this ? null : t.loadTexture && t.loadTexture(e)
          );
          d || (d = s.loadTexture(e));
          const l = d.then(
            (e) => (
              e.addEventListener("dispose", () => {
                b.delete(n);
              }),
              e
            )
          );
          return b.set(n, l), l;
        }
      }
      const b = new Map();
      var w = s(1867);
      let I, D;
      function C(e, t) {
        return (
          I ||
          ((I = new w.KTX2Loader()),
          I.setTranscoderPath("libs/three@0.128.0/basis/"),
          I.detectSupport(e),
          I.basisLoader._initTranscoder(),
          (I.manager = t),
          I)
        );
      }
      const _ = new u.Z("tiled-mesh"),
        A = (p.Jk, p.br, p.yX, p.tE);
      p.ig;
      class MttrTileLoader {
        constructor(e, t, s, i) {
          (this.container = e),
            (this.chunkFactory = i),
            (this.name = "MttrTileLoader"),
            (this.geometricErrors = g.t.debugGeometricError
              .split(",")
              .map((e) => Number(e))),
            (this.loadStats = {
              startTimes: {
                start: 0,
                tileset: 0,
                texinfo: 0,
                lod0: 0,
                lod1: 0,
              },
              timings: { tileset: "", texinfo: "", lod0: "", lod1: "" },
            }),
            (this.tilesByLod = {}),
            (this.chunksByLod = {}),
            (this.onLodLoaded = new Map()),
            (this.onChunksLoaded = new Set()),
            (this.minimalLoaded = !1),
            (this.checkLoadStatus = (() => {
              let e = !1,
                t = !1;
              return () => {
                (e && t) ||
                  (e ||
                    ((e = this.notifyIfFullyLoaded(0)),
                    e &&
                      (_.error(
                        "LOD0 fully downloaded, allow showing more lods"
                      ),
                      (this.minimalLoaded = !0),
                      (this.loadStats.timings.lod0 =
                        (
                          performance.now() - this.loadStats.startTimes.lod0
                        ).toFixed(1) + "ms"),
                      (this.loadStats.startTimes.lod1 = performance.now()))),
                  t ||
                    ((t = this.notifyIfFullyLoaded(1)),
                    t &&
                      (this.loadStats.timings.lod1 =
                        (
                          performance.now() - this.loadStats.startTimes.lod1
                        ).toFixed(1) + "ms")));
              };
            })()),
            (this.loadStats.startTimes.start = performance.now()),
            (this.loadStats.startTimes.texinfo = performance.now());
          const r = t.getSignedUrlSync(`${x.Sq}/${x.eP}`);
          g.t.debug
            ? (this.tilesRenderer = new c.cj(r))
            : (this.tilesRenderer = new m.I(r));
          const o = (function (e, t) {
            D ||
              ((D = new M.DRACOLoader()),
              D.setDecoderPath("libs/three@0.128.0/draco/gltf/"),
              D.preload());
            const s = new S.GLTFLoader(t);
            s.setDRACOLoader(D),
              s.register((e) => new MTTRMeshBvh(e)),
              CrossModelTextureCache.addToLoader(s);
            const i = C(e, t);
            return s.setKTX2Loader(i), s;
          })(s, this.tilesRenderer.manager);
          this.configureTilesRenderer(this.tilesRenderer, o),
            this.configureUrlSigning(this.tilesRenderer, t);
        }
        setSize(e, t, s) {
          this.tilesRenderer.setCamera(e),
            this.tilesRenderer.setResolution(e, t, s);
        }
        notifyOnChunksLoaded(e) {
          return (0, T.k1)(
            () => this.onChunksLoaded.add(e),
            () => this.onChunksLoaded.delete(e),
            !0
          );
        }
        awaitLod(e) {
          const t = this.onLodLoaded.get(e) || [],
            s = new Promise((e, s) => {
              t.push(e);
            });
          return this.onLodLoaded.set(e, t), s;
        }
        update() {
          this.tilesRenderer instanceof c.cj &&
            ((this.tilesRenderer.displayBoxBounds = g.t.displayBoxBounds),
            (this.tilesRenderer.colorMode = g.t.colorMode)),
            this.minimalLoaded
              ? ((this.tilesRenderer.maxDepth = g.t.maxDepth + 2),
                (this.tilesRenderer.displayActiveTiles =
                  g.t.displayActiveTiles),
                (this.tilesRenderer.loadSiblings = g.t.loadSiblings),
                (this.tilesRenderer.optimizeRaycast = g.t.optimizeRaycast),
                (this.tilesRenderer.stopAtEmptyTiles = g.t.stopAtEmptyTiles),
                (this.tilesRenderer.autoDisableRendererCulling =
                  g.t.autoDisableRendererCulling))
              : ((this.tilesRenderer.maxDepth = g.t.initialMaxDepth + 2),
                (this.tilesRenderer.loadSiblings = !0)),
            (this.tilesRenderer.errorTarget = g.t.errorTarget),
            this.tilesRenderer.update(),
            this.checkLoadStatus();
        }
        configureUrlSigning(e, t) {
          e.fetchOptions.mode = "cors";
          e.preprocessURL = (e) =>
            e.startsWith("blob")
              ? e
              : (e.startsWith("lod") && (e = `${x.Sq}/${e}`),
                t.getSignedUrlSync(e));
        }
        configureTilesRenderer(e, t) {
          const s = e.calculateError.bind(e);
          (e.calculateError = (e) => {
            s(e),
              this.adjustScreenSpaceError &&
                (e.__error = this.adjustScreenSpaceError(e.__error, e));
          }),
            e.manager.addHandler(/\gltf$/, t),
            e.manager.addHandler(/\glb$/, t),
            (e.errorTarget = g.t.errorTarget),
            (e.maxDepth = 1),
            (e.loadSiblings = g.t.loadSiblings),
            (e.stopAtEmptyTiles = g.t.stopAtEmptyTiles),
            e instanceof c.cj && (e.displayBoxBounds = g.t.displayBoxBounds),
            (e.displayActiveTiles = g.t.displayActiveTiles),
            this.container.add(e.group);
          const i = new h.Quaternion().setFromAxisAngle(
            new h.Vector3(-1, 0, 0),
            h.MathUtils.degToRad(90)
          );
          this.container.quaternion.copy(i),
            this.container.updateMatrixWorld(!0),
            (e.onLoadTileSet = this.onLoadTileset.bind(this)),
            (e.onLoadModel = this.onLoadModel.bind(this));
        }
        async onLoadModel(e, t) {
          var s;
          const i = (function (e, t, s, i) {
              var r, o, n, d;
              const l = [],
                h =
                  (null === (r = t.extras) || void 0 === r
                    ? void 0
                    : r.floorIndex) || 0,
                u =
                  (null === (o = t.extras) || void 0 === o
                    ? void 0
                    : o.roomIndex) || 0,
                m = L.get(h, u),
                p =
                  (null === (n = t.extras) || void 0 === n ? void 0 : n.id) ||
                  "" + e.id,
                g =
                  (null === (d = t.extras) || void 0 === d
                    ? void 0
                    : d.textureName) || p;
              return (
                (e.name = p),
                e.traverse((e) => {
                  var r, o, n, d, T;
                  if (((e.matrixAutoUpdate = !1), e instanceof a.g)) {
                    const {
                        group: a,
                        subgroup: h,
                        type: u,
                      } = (0, R.xc)(e.name),
                      L = i(a, h, e.geometry, g);
                    (e.name = `${e.name}`),
                      (e.userData.tileName = p),
                      (e.userData.textureName = g),
                      (e.userData.tileExtras = t.extras),
                      (e.userData.chunks = l),
                      (L.textureSizeMax =
                        null === (r = t.extras) || void 0 === r
                          ? void 0
                          : r.maxTextureSize);
                    const x = t.extras
                      ? (null !== (o = t.extras.maxTextureSize) && void 0 !== o
                          ? o
                          : 0) *
                        (null !== (n = t.extras.textureScale) && void 0 !== n
                          ? n
                          : 0)
                      : 0;
                    (L.textureSizeEmbedded = x > 0 ? x : void 0),
                      (L.meshType = u),
                      (L.lod =
                        (null === (d = t.extras) || void 0 === d
                          ? void 0
                          : d.level) || 0),
                      (L.name = e.name),
                      (L.chunkIndex =
                        (null === (T = t.extras) || void 0 === T
                          ? void 0
                          : T.chunkIndex) || 0),
                      L.notifyOnMaterialUpdated((t) => {
                        (e.material = t), s && (e[c.se] = t);
                      });
                    const f = {};
                    m && m.getCurrentUniformValues(f),
                      (f.map = e.material.map),
                      (e.material = L.setMaterialsUniform(f)),
                      (e.meshGroup = a),
                      (e.meshSubgroup = h),
                      e.buildWithTileChunk(L),
                      l.push(L);
                  }
                  l.length && L.set(h, u, l[0]);
                }),
                l
              );
            })(e, t, g.t.debug, this.chunkFactory),
            r =
              (null === (s = t.extras) || void 0 === s ? void 0 : s.level) || 0;
          this.chunksByLod[r] = (this.chunksByLod[r] || []).concat(i);
          for (const e of i) this.container.addChunk(e);
          for (const e of this.onChunksLoaded.values()) e(i, t);
          this.onModelLoaded && this.onModelLoaded(e);
        }
        onLoadTileset(e) {
          this.tileset = e;
          const t = (
            performance.now() - this.loadStats.startTimes.start
          ).toFixed(1);
          (this.loadStats.timings.tileset = t + "ms"),
            _.error(
              `Tileset info load: ${t}ms`,
              this.tileset,
              this.tilesRenderer,
              this
            ),
            (this.tileset.geometricError = 1 / 0),
            (this.tileset.root.geometricError = 1 / 0),
            this.tilesRenderer.traverse(
              (e) => {
                if (e.extras && void 0 !== e.extras.level) {
                  this.tilesByLod[e.extras.level] = (
                    this.tilesByLod[e.extras.level] || []
                  ).concat(e);
                  const t = e.extras.level;
                  e.geometricError = this.geometricErrors[t];
                }
                return !1;
              },
              () => !1
            ),
            this.tilesRenderer instanceof c.cj &&
              ((this.tilesRenderer.maxDebugDistance = 300),
              (this.tilesRenderer.maxDebugError = 10),
              (this.tilesRenderer.maxDebugDepth = 7)),
            (this.loadStats.startTimes.lod0 = performance.now()),
            this.tilesRenderer.update();
        }
        notifyIfFullyLoaded(e) {
          if (!this.tilesByLod[e]) return !1;
          const t = this.tilesByLod[e].filter((e) => e.__loadingState !== A);
          if (0 === t.length)
            for (const t of this.onLodLoaded.get(e) || [])
              t(this.chunksByLod[e]);
          return 0 === t.length;
        }
      }
      var k = s(67790),
        O = s(57937);
      class ModelMeshTiled extends n.e {
        constructor(e, t) {
          super(),
            (this.uuid = e),
            (this.signedUrls = t),
            (this.boundingBox = new h.Box3()),
            (this.size = new h.Vector3()),
            (this.center = new h.Vector3()),
            (this.bindings = []),
            (this.setFloorRoomId = (e) => {
              this.meshGroups &&
                e instanceof a.g &&
                ((e.floorId = this.meshGroups.floorIds[e.meshGroup]),
                (e.roomId =
                  this.meshGroups.roomIds.get(e.meshGroup, e.meshSubgroup) ||
                  ""));
            }),
            (this.isActiveRoomMeshFilter = (e) => {
              let t = e;
              for (; t; ) {
                if (t === this) return !0;
                t = t.parent;
              }
              return !1;
            });
        }
        dispose() {
          this.bindings.forEach((e) => e.cancel()), (this.bindings = []);
        }
        async load(e, t, s, i, r, n, d) {
          g.t.debug && o.Z.load(o.Z.menus.StreamingMesh, e),
            (r.root = this),
            await this.signedUrls.refresh(),
            (this.tiledRenderer = new MttrTileLoader(
              this,
              this.signedUrls,
              t,
              n
            )),
            this.tiledRenderer.setSize(s, i.width, i.height),
            this.bindings.push(
              e.subscribe(k.a, (e) => {
                this.tiledRenderer.setSize(s, e.width, e.height);
              })
            ),
            (this.tiledRenderer.onModelLoaded = (e) => {
              e.traverse((e) => {
                (0, l.oR)(e) &&
                  (this.setFloorRoomId(e),
                  r.rooms.add(e),
                  this.inputIni &&
                    this.registerMeshForCollision(this.inputIni, e));
              }),
                r.commit();
            }),
            (this.tiledRenderer.tilesRenderer.onDisposeModel = (e) => {
              e.traverse((e) => {
                e instanceof a.g && r.rooms.delete(e);
              }),
                r.commit();
            }),
            this.initTileLodAdjustments(this.tiledRenderer, d);
          const u = setInterval(() => {
            this.tiledRenderer.update();
          }, 16);
          await this.tiledRenderer.awaitLod(0),
            this.tiledRenderer.tilesRenderer.getBounds(this.boundingBox);
          const c = new h.Matrix4().set(
            1,
            0,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            -1,
            0,
            0,
            0,
            0,
            0,
            1
          );
          this.boundingBox.applyMatrix4(c),
            this.boundingBox.getSize(this.size),
            this.boundingBox.getCenter(this.center),
            clearInterval(u);
        }
        initTextureLoader(e, t, s, i) {
          return (
            (e.autoLoadTiles = !1),
            e.setModel(O.o.TILE, this, this._chunks),
            this.tiledRenderer.notifyOnChunksLoaded((t) => {
              e.addChunkSlots(t);
            }),
            Promise.resolve()
          );
        }
        initTileLodAdjustments(e, t) {
          const s = new Map(),
            i = new Map();
          this.bindings.push(
            e.notifyOnChunksLoaded((e, t) => {
              for (const i of e) s.set(i, t);
            }),
            t.notifyOnNewSighting((e, t) => {
              let r = s.get(e);
              for (; r; ) i.set(r, Date.now()), (r = r.parent);
            })
          ),
            (e.adjustScreenSpaceError = (e, t) => (
              t.extras &&
                g.t.useOcclusionInfo &&
                Date.now() - (i.get(t) || 0) > g.t.tileSightingTTL &&
                (e *= 0.1),
              e
            ));
        }
        registerCollision(e) {
          (this.inputIni = e),
            this.tiledRenderer.tilesRenderer.forEachLoadedModel((t) => {
              t.traverse((t) => {
                (0, l.oR)(t) && this.registerMeshForCollision(e, t);
              });
            });
        }
        registerMeshForCollision(e, t) {
          var s;
          e.registerMesh(t, !0, this.isActiveRoomMeshFilter),
            1 ==
              +(null === (s = t.userData.tileExtras) || void 0 === s
                ? void 0
                : s.level) && e.registerSnappingMesh(t);
        }
        onMeshIdsUpdated(e) {
          (this.meshGroups = e),
            this.tiledRenderer.tilesRenderer.forEachLoadedModel((e, t) => {
              e.traverse(this.setFloorRoomId);
            });
        }
        addChunk(e) {
          this._chunks.push(e);
        }
        onUpdate() {
          g.t.disableTileUpdates || this.tiledRenderer.update();
        }
        setTextureQuality(e, t, s) {
          e.setQuality((0, d.q6)(O.o.TILE, 0), (0, d.t3)(O.o.TILE, 3));
        }
      }
      async function N({
        uuid: e,
        urls: t,
        engine: s,
        settings: o,
        roomMeshData: n,
        chunkFactory: a,
        chunkVisibilityChecker: d,
      }) {
        (o.flipDownload = !1), (o.flipUpload = !1);
        const l = new ModelMeshTiled(e, t),
          [h, u] = await Promise.all([
            s.getModuleBySymbol(i.y.WEBGL_RENDERER),
            s.market.waitForData(r.M_),
          ]);
        return await l.load(s, h.threeRenderer, h.getCamera(), u, n, a, d), l;
      }
    },
  },
]);
